import request from '@/utils/request'
// 添加数据转换规则
export const addTransformRule = (data) => {
  return request.post('/dataTransformRule/add', data)
}
// 编辑数据转换规则
export const updateTransformRule = (data) => {
  return request.put('/dataTransformRule/update', data)
}
// 删除数据转换规则
export const deleteTransformRule = (id) => {
  return request.delete(`/dataTransformRule/delete/${id}`)
}
// 根据id查询数据转换规则
export const getTransformRuleById = (id) => {
  return request.get(`/dataTransformRule/select/${id}`)
}
// 数据转换规则分页查询
export const getTransformRuleList = (params) => {
  return request.get('/dataTransformRule/list', params)
}
// 获取转换规则（根据采集配置id）
export const getTransformRuleByCollectConfigId = (collectConfigId) => {
  return request.get(`/dataTransformRule/selectWithCollectConfig/${collectConfigId}`, collectConfigId)
}
// 获取支持的转换类型
export const getTransformTypeList = (data) => {
  return request.get('/dataTransformRule/types', data)
}
// 执行数据转换
export const executeTransform = (key) => {
  return request.post('/dataTransformRule/execute', key)
}
// 规则预览
export const previewTransformRule = (key) => {
  return request.post('/api/transform/preview', key)
}
// 单个规则执行
export const executeTransformRule = (key) => {
  return request.post('/api/transform/execute', key)
}
// 批量规则执行
export const executeTransformRules = (key) => {
  return request.post('/api/transform/batch-execute', key)
}
// 获取支持的规则类型
export const getTransformRuleTypes = () => {
  return request.get('/api/transform/supported-types')
}
